<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>鋆石机器人</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">

</head>
<body>
<div class="layui-layout layui-layout-admin ">
    <div class="layui-header ">
        <div class="layui-logo">鋆石机器人后台管理系统</div>
        <ul class="layui-nav layui-layout-right" >
            <li class="layui-nav-item">
                <a href="javascript:;" id="adminimg">
                    <img src="/static/image/admintou.jpg" class="layui-nav-img"><!--头像-->
                    <!--用户名-->
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">设置</a></dd>
                    <dd><a href="">设置</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="/logout">退出登录</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" lay-filter="menus" lay-shrink="all" id="listAll">
            </ul>
        </div>
    </div>

    <div class="layui-body">

        <!-- 内容主体区域 -->
        <iframe src="" width="99.6%" height="100%" name="mainstart"></iframe>
        <!--        <div style="padding: 15px;">内容主体区域</div>-->
    </div>

    <div class="layui-footer">
        <p style="text-align: center">问渠哪得清如许，为有源头活水来。</p>
        <!-- 底部固定区域 -->
    </div>
</div>
<script src="/static/layui/layui.js"></script>
<script src="/static/js/axios.js"></script>
<script>
    //JavaScript代码区域
    layui.use(['element', 'jquery'], function () {
        const element = layui.element,
            $ = layui.$;
        const users = JSON.parse(window.sessionStorage.getItem("users"));//获取当前登录账户
        $("#adminimg").append("姓名：" + users.userName + "  " + "账户：" + users.userAccount);
        const usersys = JSON.parse(window.sessionStorage.getItem("userssys"));//获取当前登录账户权限
        let list = "";
        for (let i = 0; i < usersys.length; i++) {
            if (usersys[i].privilegeType == 1) {
                list += "<li class=\"layui-nav-item\">";
                list += "<a class=\"\" href=\"javascript:;\">" + usersys[i].privilegeName + "</a>";
                list += "<dl class=\"layui-nav-child\">";
                for (let c = 0; c < usersys.length; c++) {
                    if (usersys[c].privilegeType == 2 && usersys[c].permission.indexOf(usersys[i].permission.substr(0, 6)) != -1) {
                        list += "<dd><a href="+usersys[c].pathUrl+" target='mainstart'>" + usersys[c].privilegeName + "</a></dd>";
                    }
                }
                list += "</dl>";
                list += "</li>";

            }
        }
        $("#listAll").append(list);
       //重新渲染layui
        element.init();
    });
</script>
</body>
</html>